/**
 * 
 */
package at.ac.tuwien.swa075.telco.hlr.dao;

import java.util.List;

import at.ac.tuwien.swa075.telco.hlr.HlrException;
import at.ac.tuwien.swa075.telco.hlr.dao.entity.SubscriptionEntity;

/**
 * @author vovmj01
 *
 */
public interface ISubscriberDAO {
	/**
	 * Deletes an existing subscriber
	 * @param subscriberId The subscriber id to delete.
	 * @return true if the subscriber was deleted.
	 * @throws HlrException An error occured while deleting the subscriber.
	 */
	public boolean deleteSubscriber(int subscriberId) throws HlrException;
	
	/**
	 * Returns all subscriptions with a given status.
	 * @param status The status as a string.
	 * @return The list of subscriptions.
	 * @throws AucException An error occured during search.
	 */
	public List<SubscriptionEntity> selectSubscriptionsByStatus(String status) throws HlrException;
	
	public SubscriptionEntity findSubscription(int id) throws HlrException;
	
	/**
	 * Lookup a single subscription identified by the equipment id.
	 * @param imei The international mobile equipment id.
	 * @return The subscription.
	 * @throws HlrException An error occured during lookup.
	 */
	public SubscriptionEntity findSubscriptionByEquipment(String imei) throws HlrException;
	
	/**
	 * Lookup a single subscription identified by the international mobile subscription id.
	 * @param imsi The international mobile subscription id.
	 * @return The subscription.
	 * @throws HlrException An error occured during lookup.
	 */
	public SubscriptionEntity findSubscriptionByImsi(String imsi) throws HlrException;
	
	/**
	 * Lookup a single subscription identified by the phone number and the prefix code.
	 * @param code The prefix number.
	 * @param number The phone number
	 * @return The subscription.
	 * @throws HlrException An error occured during the search.
	 */
	public SubscriptionEntity findSubscriptionByPhoneNumber(String code, String number) throws HlrException;
	
	/**
	 * Creates a new subscription with the given data.
	 * 
	 * @param subscription The subscription object.
	 * @return Returns the subscription id.
	 * @throws HlrException An error occured while creating a new subscription
	 */
	public int insertSubscription(SubscriptionEntity subscription) throws HlrException;
	
	/**
	 * Updates the data of an existing subscription.
	 * @param subscription The subscription object.
	 * @return Returns true if data was changed.
	 * @throws HlrException An error occured while updating the data.
	 */
	public boolean updateSubscription(SubscriptionEntity subscription) throws HlrException;
}
